package com.example.baselib.widget;

import com.example.baselib.utils.UIUtils;
import ohos.agp.colors.Color;
import ohos.agp.colors.RgbColor;
import ohos.agp.components.AttrSet;
import ohos.agp.components.ComponentContainer;
import ohos.agp.components.StackLayout;
import ohos.agp.components.element.ShapeElement;
import ohos.app.Context;

public class HeadComponent extends StackLayout implements IRComponent {

    //加载状态
    private RCState rcState = RCState.STATE_INIT;
    //默认最小高度
    private int def_height = 60;

    //阻力值
    public float minDamp = 1.6f;
    public float maxDamp = 2.2f;


    public HeadComponent(Context context) {
        this(context, null);
    }

    public HeadComponent(Context context, AttrSet attrSet) {
        this(context, attrSet, null);
    }

    public HeadComponent(Context context, AttrSet attrSet, String styleName) {
        super(context, attrSet, styleName);
    }

    @Override
    public void init(ComponentContainer.LayoutConfig layoutConfig) {
        ShapeElement element = new ShapeElement();
        element.setRgbColor(new RgbColor(255, 0, 0));
        setBackground(element);
    }

    @Override
    public int getMinLoadHeight() {
        return UIUtils.vp2px(getContext(), def_height);
    }

    @Override
    public boolean isLoading() {
        return false;
    }

    @Override
    public void onFinish() {

    }

    @Override
    public void setRCState(RCState rcState) {
        this.rcState = rcState;
    }

    @Override
    public RCState getRCState() {
        return rcState;
    }


}
